using Crux.Core.StackExchangeRedis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace System;
/// <summary>
/// StackExchangeRedisServiceCollectionExtension
/// </summary>
public static class StackExchangeRedisServiceCollectionExtension
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="serviceDescriptors"></param>
    /// <returns></returns>
    public static IServiceCollection AddRedisSupport(this IServiceCollection serviceDescriptors)
    {
        serviceDescriptors.TryAddSingleton<IRedisConnectionHelm, RedisConnectionHelm>();
        serviceDescriptors.TryAddScoped<IRedisFacade, RedisOperator>();
        serviceDescriptors.TryAddScoped<IRedisOperator, RedisOperator>();

        return serviceDescriptors;
    }
}